package com.lwj.diao.handlers;

import com.lwj.diao.Htmls;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import java.io.IOException;

public class WelcomeHandler implements HttpHandler {
    final byte[] mWelcomeBytes = Htmls.HTML_WELCOME.toString().getBytes(Htmls.UTF8_CS);
    @Override
    public void handle(HttpExchange exchange) throws IOException {
        exchange.sendResponseHeaders(200, this.mWelcomeBytes.length);
        exchange.getResponseBody().write(this.mWelcomeBytes);
        exchange.getResponseBody().close();
    }
}